<%@ page language="java" import="com.util.StringFinal" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap core CSS -->
<link rel="stylesheet" type="text/css"
	href="../../bootstrap-3.3.7/dist/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css"
	href="../../bootstrap-3.3.7/dist/css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="../../css/index.css" />
<link rel="stylesheet" type="text/css" href="../../css/personal.css" />
<link rel="stylesheet" type="text/css" href="../../css/background.css" />
<link rel="stylesheet" type="text/css"
	href="../../css/upload/fileinput.css" />

<link href="../../css/bootstrap-datetimepicker.min.css" rel="stylesheet" />

<script type="text/javascript"
	src="../../bootstrap-3.3.7/dist/js/jquery.min.js"></script>
<script type="text/javascript"
	src="../../bootstrap-3.3.7/dist/js/bootstrap.js"></script>
<script type="text/javascript" src="../../js/upload/fileinput.js"></script>
<script type="text/javascript" src="../../js/login/jquery.form.min.js"></script>
<script type="text/javascript" src="../../js/upload/zh.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link
	href="../../bootstrap-3.3.7/docs/assets/css/ie10-viewport-bug-workaround.css"
	rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<script src="../../js/moment-with-locales.js"></script>
<script src="../../js/bootstrap-datetimepicker.min.js"></script>
<script src="../../js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<script type="text/javascript" src="../../js/wordcontrol.js"></script>
</head>
<body>
	<div class="container">
		<div class="row clearfix">
			<div class="col-md-12" style="padding-bottom: 10px">
				<%@include file="../common/header.jsp"%>
			</div>
		</div>
		<div class="row clearfix">
			<div class="col-md-12">
				<h4 class="heading">知识上传</h4>
				<div class="myline"></div>
				<form class="form-horizontal" enctype="multipart/form-data"
					style="padding-top: 20px" id="uploadForm" method="post">
					<div class="row">
						<div class="col-md-2"></div>
						<div class="col-md-7">
							<div class="form-group">
								<label class="col-md-3 control-label">篇名:</label>
								<div class="col-md-7">
									<input type="text" class="form-control" name="info_name"
										id="info_name">
								</div>
								<div class="col-md-2">
									<span style="color: red;">必填</span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label">作者:</label>
								<div class="col-md-9">
									<input type="text" class="form-control" name="info_author">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label">作者单位:</label>
								<div class="col-md-9">
									<input type="text" class="form-control" name="info_company">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label">关键词:</label>
								<div class="col-md-9">
									<input type="text" class="form-control" name="info_keyword">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label">发布日期:</label>
								<div class="col-md-9">
									<a class='input-group date' id='datetime'> <input
										type='text' class="form-control" id='nowdate'
										style="width: 300px;" name="info_time" /> <span
										class="input-group-addon" style="width: 50px;"> <span
											class="glyphicon glyphicon-calendar"></span>
									</span>
									</a>
								</div>
							</div>

							<div class="form-group">
								<label class="col-md-3 control-label">发布部门:</label>
								<div class="col-md-9">
									<input type="text" class="form-control" name="info_bm">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label">文献来源:</label>
								<div class="col-md-9">
									<input type="text" class="form-control" name="info_source">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label">文号:</label>
								<div class="col-md-9">
									<input type="text" class="form-control" name="info_wh">
								</div>
							</div>
							<div class="form-group">
								<label class="col-md-3 control-label">摘要:</label>
								<div class="col-md-9">
									<textarea id="ml_default" cols="30" rows="4"
										class="form-control" name="info_abstract"
										onKeyUp="ControlWordCount(&quot;ml_default&quot;,&quot;count&quot;,<%=StringFinal.information_length%>)"></textarea>
									<p style="float: right; margin-top: 5px">
										你还可以输入<span id="count"><%=StringFinal.information_length%></span>个字
									</p>
								</div>

							</div>
							<div class="form-group">
								<label class="col-md-3 control-label">上传:</label>
								<div class="col-md-7">
									<input id="fileinput" name="fileinput" type="file">
								</div>
								<div class="col-md-12" style="margin-top: 20px">
									<div class="col-md-3"></div>
									<div class="col-md-9">
										<span style="color: blue">(请选择doc、pdf、excel、ppt、avi、mp4、rmvb、caj格式的文件,大小不超过10M)</span>
									</div>
								</div>
							</div>
							<center>
								<div class="form-group sepH_c">
									<div class="col-md-12">
										<button type="button" class="btn  btn-info" id="tjupload"
											onclick="submitForm()">提交信息</button>
									</div>
								</div>
							</center>
						</div>
					</div>
				</form>
			</div>
		</div>
		<div class="row clearfix">
			<div class="col-md-12" style="padding-bottom: 10px">
				<%@include file="../common/bottom.jsp"%>
			</div>
		</div>
	</div>
</body>
<script>
	$(function(){
		fileinput();
		datetime();
	});
	function fileinput(){
		$("#fileinput").fileinput({
	        browseLabel: '选择文件',
			language: 'zh', //设置语言
	        showPreview:false,
	        allowedFileExtensions: ['doc','pdf','docx','ppt','pptx','avi','mp4','rmvb','caj','xls','xlsx'],//接收的文件后缀
	        showUpload: false, //是否显示上传按钮
	        showCaption: true,//是否显示标题
	        browseClass: "btn btn-primary", //按钮样式  
	        uploadAsync: false, //默认异步上传
	        maxFileSize: 1024*1024,//单位为kb，如果为0表示不限制文件大小
	        minFileCount: 0,
	        maxFileCount: 20, //表示允许同时上传的最大文件个数
	        enctype: 'multipart/form-data',
	        validateInitialCount:true,
	        msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
	        language:'zh',
	    });
	}
	function datetime(){
		$('#datetime').datetimepicker({
	        language: 'zh-CN',//显示中文
	        format: 'yyyy-mm-dd',//显示格式
	        minView: "month",//设置只显示到月份
	        initialDate: new Date(),
	        autoclose: true,//选中自动关闭
	        todayBtn: true,//显示今日按钮
	        locale: moment.locale('zh-cn')
	    });
		
	}
	function submitForm(){
    	$("#tjupload").attr("disabled",true);
		var infoname=$("#info_name").val();
		var infofile=$("#fileinput").val();
		if(infoname==""||infoname==null){
			alert("请输入篇名");
			return;
		}
		if(infofile==""||infofile==null){
			alert("请选择文件");
			return;
		}
		$("#uploadForm").ajaxSubmit({
			url:"singleuploadInfo",
			success:function(result){
				if(result==1){
					alert("上传成功");
					window.location="p_getuploadview";

				}
				else
					alert("上传失败");
		    	$("#tjupload").attr("disabled",false);
			}
		});
	}
</script>
</html>